home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FishMarket 1.0
/
FishMarket v1.0.iso
/
fishies
/
076-100
/
disk_098
/
hddriver
/
driver
/
posn.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-05-06
|
1KB
|
41 lines
/*
* Copyright 1987 Alan Kent
*
* Permission is granted to redistribute this code as long
* as this message is retained in the code and the code is
* not sold without written permission from the author.
*
* UUCP: {seismo,hplabs,mcvax,ukc,nttlab}!munnari!goanna.oz!ajk
* ACSnet: ajk@goanna.oz
* ARPA: munnari!goanna.oz!ajk@SEISMO.ARPA
*/
#include "hd.h"
BOOL
calc ( ior , posn , num_secs )
register struct IOStdReq *ior;
register struct posn *posn;
LONG *num_secs;
{
if ( ior->io_Offset < 0
|| ior->io_Length < 0
|| ( ior->io_Offset % HD_SECTOR ) != 0
|| ( ior->io_Length % HD_SECTOR ) != 0 ) {
ior->io_Error = TDERR_NotSpecified;
return ( FALSE );
}
posn->block = ior->io_Offset / HD_SECTOR;
posn->sector = posn->block % first.sectors;
posn->surface = ( posn->block / first.sectors ) % first.heads;
posn->cylinder = posn->block / ( first.sectors * first.heads );
*num_secs = ior->io_Length / HD_SECTOR;
if ( posn->cylinder >= first.cylinders ) {
ior->io_Error = TDERR_NotSpecified;
return ( FALSE );
}
return ( TRUE );
}